package project.meetemup.view.start;

import project.meetemup.view.MainMenuActivity;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.view.Window;
import android.view.WindowManager;

/**
 * Initial activity. Set up first application screen.
 * 
 * @since 19/05/2012
 * @author Thiago maciel Batista
 * 
 */
public class StartActivity extends Activity {
	private StartView startView;

	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);		
		startView = new StartView(this);
		getFullscreen();
		setContentView(startView);		
	}

	@Override
	protected void onResume() {
		super.onResume();
		Handler handler = new Handler();
		handler.postDelayed(new Runnable() {
			public void run() {
				onStop();
			}
		}, 5000);		
	}

	@Override
	protected void onStop() {
		super.onStop();
		RediretToMainMenu();
	}

	public void getFullscreen() {
		requestWindowFeature(Window.FEATURE_NO_TITLE);
		getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, 
				WindowManager.LayoutParams.FLAG_FULLSCREEN);
	}

	private void RediretToMainMenu() {
		this.finish();
		Intent myIntent = new Intent(this, MainMenuActivity.class);
		//Intent myIntent = new Intent(this, MainProfileActivity.class);
		// myIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
		startActivity(myIntent);
	}
}
